# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=libwbxml
pkgver=0.11.7
pkgrel=0
pkgdesc="A library to encode and decode WBXML (WAP Binary XML)."
url="https://github.com/libwbxml/libwbxml"
arch="all"
license="LGPL-2.1-or-later"
makedepends="cmake expat-dev"
checkdepends="check-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/libwbxml/libwbxml/archive/libwbxml-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgname-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DENABLE_UNIT_TEST=ON \
		$CMAKE_CROSSOPTS
	make -C build
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/lib
	mv "$pkgdir"/usr/share/cmake "$pkgdir"/usr/lib
}

sha512sums="fc855650661593596a158527682d2c40d800c1fa44169d79e9ca9c6d64d67b6c660807ed89b1bddd644f114c27711356627ac919af91fd7f19d409879505512f  libwbxml-0.11.7.tar.gz"
